import {defineStore} from "pinia";

export const useStore = defineStore("store", {
    unistorage: true, // 是否持久化
    state: () => ({
        hasLogin: false,        // 判断是否登录
        token: '',              // 用户登录的token
        userId: '',           // 用户编号
        userName: '',           // 用户名
        avatarUrl: '',          // 用户头像
        phone: '',              // 用户手机号码
    }),
    getters: {
    },
    actions: {
        loginIn: (state, token,userId, userName, avatarUrl) => {
            state.hasLogin = true;
            state.token = token;
            state.userId = userId;
            state.userName = userName;
            state.avatarUrl = avatarUrl;
        }
    }
})
